package com.zhongke.cotrun.mapper;


import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhongke.cotrun.model.pojo.PayOrder;

/**
 * @Description: 商品基本信息
 * @Author: songjing
 * @Date:   2020-03-20
 * @Version: V1.0
 */
public interface PayOrderMapper extends BaseMapper<PayOrder> {
	/**
     * 根据orderCode查看订单详情
     *
     * @param 订单号
     * @return
     */
	@Select("SELECT * from pay_order WHERE order_code=#{orderCode} and del_flag='0' limit 1")
	public PayOrder selectDetailByOrderCode(String orderCode);
	/**
	 * 查询指定用户需求信息
	 * @param userId用户表主键
	 * @param searchKey检索关键词
	 * @return
	 */
    public List<Map> selectAllByMine(@Param("userId") Long userId,@Param("searchKey") String searchKey,@Param("state") String state,@Param("appraiseState") String appraiseState);
   
    /**
	 * 查询指定商品的信息
	 * @param mainId 商品关联对于主体主键
	 * @param searchKey检索关键词
	 * @return
	 */
    public List<Map> selectAllByMain(@Param("mainId") Long mainId,@Param("type") String type,@Param("searchKey") String searchKey,@Param("state") String state,@Param("appraiseState") String appraiseState);
  
    
    /**
     * 查询过期未支付订单
     * @return
     */
    @Select("SELECT * from pay_order where TIMESTAMPDIFF(MINUTE,create_date,NOW())>30 and state='0'")
	public List<PayOrder> selectOutTimeListByEndTime();
}
